/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.menosehmais.business;

import br.com.caelum.vraptor.ioc.Component;
import br.com.menosehmais.framework.business.CrudBusinessObject;
import br.com.menosehmais.model.EmpresaDO;
import br.com.menosehmais.model.PortletDO;
import br.com.menosehmais.persistence.PortletDAO;
import java.util.List;

/**
 *
 * @author Junior JAFJ
 */
@Component
public class PortletBO extends CrudBusinessObject<PortletDO, PortletDAO> {
    
    public PortletBO( PortletDAO dao ){
        super(dao);
    }
    
    public List<PortletDO> listarPortlets() {
        List<PortletDO> todos = dao.consultarPortlets();        
        return todos;
    }
    
    public List<PortletDO> listarEmpresaPortlet(EmpresaDO empresaDO) {
        PortletDO portletDO = new PortletDO();
        portletDO.setEmpresa(empresaDO);
        portletDO.setAtivo(true);
        List<PortletDO> portlets = dao.selectUsingFilter(portletDO);
        return portlets;
    }
    
    public List<PortletDO> listarNivel3() {
        return null;
    }
    
    public void insertValue(PortletDO portlet) {
        dao.insert(portlet);
    }

    public PortletDO selectPortlet(String idPortlet) {
        PortletDO portletDO = new PortletDO();
        portletDO.setId(idPortlet);
        portletDO = dao.selectUsingFilter(portletDO).get(0);
        return portletDO;
    }
}
